import { CardEvent } from "../../api/CardEvent";
import { Room } from "../../api/Room";
import { Card } from "../base/Card";

export class AlchemyPoison extends Card {
    title(room: Room, user: string): string {
        return '丹房铅毒';
    }

    desc(room: Room, user: string): string {
        return '破坏指定部门场上随机1张官员牌。';
    }
    
    use(room: Room, user: string, target: string): void {
        var dept = room.getDept(target);
        if (!dept) return;

        var index = Math.floor(Math.random() * dept.fieldCards.length);
        CardEvent.destroyFieldCard(room, target, index);
    }

    target(room: Room, user: string): string {
        return 'all';
    }
}